"""
ROMA 资源池 Schema 定义
"""
from pydantic import BaseModel
from typing import Optional, List, Union


class DriverInfo(BaseModel):
    """驱动信息"""
    driverVersion: Optional[str] = None
    driverState: Optional[str] = None
    updateStrategy: Optional[str] = None


class NodeMetrics(BaseModel):
    """节点指标"""
    poolQuotaLimit: Optional[int] = None
    appRuningNumber: Optional[int] = None
    appWaitingNumber: Optional[int] = None
    appQueueNumber: Optional[int] = None


class RomaPool(BaseModel):
    """ROMA 资源池"""
    id: str
    name: str
    vendor: Optional[str] = None
    poolType: Optional[str] = None
    elastic: Optional[int] = None
    elasticLevel: Optional[str] = None
    driverInfo: Optional[DriverInfo] = None
    state: Optional[str] = None
    description: Optional[str] = None
    nodeMetrics: Optional[NodeMetrics] = None


class RomaPoolListResponse(BaseModel):
    """ROMA 资源池列表响应"""
    success: Union[str, bool] = None
    msg: Optional[str] = None
    detail: Optional[str] = None
    includingDetail: Union[str, bool] = None
    errorCode: Optional[str] = None
    pools: List[RomaPool]
    shareStrategy: Optional[str] = None
